package E2014;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class Exam1{
    public static void main(String[] args) {
        Set<String> set = new TreeSet();
        int[] num = new int[]{1, 2, 3, 4};
        for (int i = 0; i < num.length; i++) {
            int a = num[i];
            for (int j = 1; j < num.length; j++) {
                int b = num[j];
                for (int k = 2; k < num.length; k++) {
                    StringBuffer buffer = new StringBuffer();
                    int c = num[k];
                    buffer = buffer.append(a).append(b).append(c);
                    String str = buffer.toString();
                    set.add(str);
                }
            }
        }
        Iterator it = set.iterator();
        while (it.hasNext()) {
            Object o = it.next();
            System.out.println(o);
        }
        System.out.println("共有"+set.size()+"个。");
    }
}
